javax.realtime
Class LTMemory

java.lang.Object
  extended byjavax.realtime.MemoryArea
      extended byjavax.realtime.ScopedMemory
          extended byjavax.realtime.LTMemory

public class LTMemory
extends ScopedMemory

LTMemory represents a memory area guaranteed by the system to have linear time allocation when memory consumption from the memory area is less than the memory area's initial size. Execution time for allocation is allowed to vary when memory consumption is between the initial size and the maximum size for the area. Furthermore, the underlying system is not required to guarantee that memory between initial and maximum will always be available.

The memory area described by a LTMemory instance does not exist in the Java heap, and is not subject to garbage collection. Thus, it is safe to use a LTMemory object as the initial memory area associated with a NoHeapRealtimeThread, or to enter the memory area using the ScopedMemory.enter() method within a NoHeapRealtimeThread.

Enough memory must be committed by the completion of the constructor to satisfy the initial memory requirement. (Committed means that this memory must always be available for allocation). The initial memory allocation must behave, with respect to successful allocation, as if it were contiguous; i.e., a correct implementation must guarantee that any sequence of object allocations that could ever succeed without exceeding a specified initial memory size will always succeed without exceeding that initial memory size and succeed for any instance of LTMemory with that initial memory size.

(Note: to ensure that all requested memory is available set initial and maximum to the same value)

Methods from LTMemory should be overridden only by methods that use super.

Not currently implemented


Field Summary
protected  SizeEstimator initialSizeEstimator
           
 
Fields inherited from class javax.realtime.MemoryArea
logic, sizeEstimator, sizeInBytes
 
Constructor Summary
LTMemory(long size)
          Create an LTMemory of the given size.
LTMemory(long initial, long maximum)
          Create an LTMemory of the given size.
LTMemory(long initial, long maximum, java.lang.Runnable logic)
          Create an LTMemory of the given size.
LTMemory(long size, java.lang.Runnable logic)
          Create an LTMemory of the given size.
LTMemory(SizeEstimator size)
          Create an LTMemory of the given size.
LTMemory(SizeEstimator size, java.lang.Runnable logic)
          Create an LTMemory of the given size.
LTMemory(SizeEstimator initial, SizeEstimator maximum)
          Create an LTMemory of the given size.
LTMemory(SizeEstimator initial, SizeEstimator maximum, java.lang.Runnable logic)
          Create an LTMemory of the given size.
 
Methods inherited from class javax.realtime.MemoryArea
enter, enter, executeInArea, getMemoryArea, memoryConsumed, memoryRemaining, newArray, newInstance, newInstance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

initialSizeEstimator

protected SizeEstimator initialSizeEstimator
Constructor Detail

LTMemory

public LTMemory(long size)
Create an LTMemory of the given size.

Not currently implemented

Parameters:
size - The size in bytes of the memory to allocate for this area. This memory must be committed before the completion of the constructor.
Throws:
java.lang.IllegalArgumentException - Thrown if size is less than zero.
java.lang.OutOfMemoryError - Thrown if there is insufficient memory for the LTMemory object or for the backing memory.

LTMemory

public LTMemory(long initial,
                long maximum)
Create an LTMemory of the given size.

Not currently implemented

Parameters:
initial - The size in bytes of the memory to allocate for this area. This memory must be committed before the completion of the constructor.
maximum - The size in bytes of the memory to allocate for this area.
Throws:
java.lang.IllegalArgumentException - Thrown if initial is greater than maximum, or if initial or maximum is less than zero.
java.lang.OutOfMemoryError - Thrown if there is insufficient memory for the LTMemory object or for the backing memory.

LTMemory

public LTMemory(long initial,
                long maximum,
                java.lang.Runnable logic)
Create an LTMemory of the given size.

Not currently implemented

Parameters:
initial - The size in bytes of the memory to allocate for this area. This memory must be committed before the completion of the constructor.
maximum - The size in bytes of the memory to allocate for this area.
logic - The run() of the given Runnable will be executed using this as its initial memory area. If logic is null, this constructor is equivalent to LTMemory(long initial, long maximum).
Throws:
java.lang.IllegalArgumentException - Thrown if initial is greater than maximum, or if initial or maximum is less than zero.
java.lang.OutOfMemoryError - Thrown if there is insufficient memory for the LTMemory object or for the backing memory.
IllegalAssignmentError - Thrown if storing logic in this would violate the assignment rules.

LTMemory

public LTMemory(long size,
                java.lang.Runnable logic)
Create an LTMemory of the given size.

Not currently implemented

Parameters:
size - The size in bytes of the memory to allocate for this area. This memory must be committed before the completion of the constructor.
logic - The run() of the given Runnable will be executed using this as its initial memory area. If logic is null, this constructor is
Throws:
java.lang.IllegalArgumentException - Thrown if size is less than zero.
java.lang.OutOfMemoryError - Thrown if there is insufficient memory for the LTMemory object or for the backing memory.
IllegalAssignmentError.html - Thrown if storing logic in this would violate the assignment rules.

LTMemory

public LTMemory(SizeEstimator size)
Create an LTMemory of the given size. This constructor is equivalent to LTMemory(size, size).

Parameters:
size - An instance of SizeEstimator used to give an estimate of the initial size. This memory must be committed before the completion of the constructor.

LTMemory

public LTMemory(SizeEstimator size,
                java.lang.Runnable logic)
Create an LTMemory of the given size. This constructor is equivalent to LTMemory(size, size, logic).

Parameters:
size - An instance of SizeEstimator used to give an estimate of the initial size. This memory must be committed before the completion of the constructor.
logic - The run() of the given Runnable will be executed using this as its initial memory area. If logic is null, this constructor is equivalent to LTMemory(long initial, long maximum).

LTMemory

public LTMemory(SizeEstimator initial,
                SizeEstimator maximum)
Create an LTMemory of the given size.

Not currently implemented

Parameters:
initial - An instance of SizeEstimator used to give an estimate of the initial size. This memory must be committed before the completion of the constructor.
maximum - An instance of SizeEstimator used to give an estimate for the maximum bytes to allocate for this area.
Throws:
java.lang.IllegalArgumentException - Thrown if initial is null, maximum is null, initial is greater than the size estimate from maximum, or if initial is less than zero.
java.lang.OutOfMemoryError - Thrown if there is insufficient memory for the LTMemory object or for the backing memory.
IllegalAssignmentError - Thrown if storing logic in this would violate the assignment rules.

LTMemory

public LTMemory(SizeEstimator initial,
                SizeEstimator maximum,
                java.lang.Runnable logic)
Create an LTMemory of the given size.

Not currently implemented

Parameters:
initial - An instance of SizeEstimator used to give an estimate of the initial size. This memory must be committed before the completion of the constructor.
maximum - An instance of SizeEstimator used to give an estimate for the maximum bytes to allocate for this area.
logic - The run() of the given Runnable will be executed using this as its initial memory area. If logic is null, this constructor is equivalent to LTMemory(long initial, long maximum).
Throws:
java.lang.IllegalArgumentException - Thrown if initial is null, maximum is null, initial is greater than the size estimate from maximum, or if initial is less than zero.
java.lang.OutOfMemoryError - Thrown if there is insufficient memory for the object or for the backing memory.
- HREF="IllegalAssignmentError.html"> IllegalAssignmentError Thrown if storing logic in this would violate the assignment rules.